Contract4J for Design by Contract in Java: Design Pattern-Like Protocols and Aspect Interfaces

نویسنده

  • Dean Wampler
چکیده

Recent trends in Aspect-oriented Design (AOD) have emphasized interface-based modularity constructs that support noninvasive advising of components by aspects in a robust and flexible way. We show how the AspectJ-based tool Contract4J supports Design by Contract in Java using two different forms of a design patternlike protocol, one based on Java 5 annotations and the other based on a JavaBeans-like method naming convention. Neither form resembles conventional Java-style interfaces, yet each promotes the same goals of abstraction and minimal coupling between the cross-cutting concern of contract enforcement and the components affected by the contracts. Unlike traditional implementations of design patterns, which tend to be ad hoc and require manual enforcement by the developer, the Contract4J protocol offers at least partial support for compile time enforcement of proper usage. This example suggests that the concept of an interface in AOD should more fully encompass usage protocols and conversely, aspects give us ways to enforce proper usage programmatically.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A Composite Design Pattern for Service Injection and Composition of Web Services for Peer-To-Peer Computing with Service Oriented Architecture

In this paper we present a Service Injection and composition Design Pattern for Unstructured Peer-to-Peer networks, which is designed with Aspect-oriented design patterns, and amalgamation of the Strategy, Worker Object, and Check-List Design Patterns used to design the Self-Adaptive Systems. It will apply selfreconfiguration planes dynamically without the interruption or intervention of the ad...

متن کامل

An Aspect-Oriented Infrastructure for Design by Contract in Java

Design by Contract was first introduced in the Eiffel programming language to address the reliability concern in Object-Oriented Software Development, namely on module interaction. On the other hand, Aspect-Oriented Software Development aims at providing a means to identify, modularise and compose cross-cutting concerns, which classical approaches for software development can not modularise. Th...

متن کامل

Specifying and Checking Method Call Sequences in JML

In a pre and postconditions style specification, it is difficult to specify allowed sequences of method calls, often called protocols. However, the protocols are essential properties of reusable object-oriented classes and application frameworks, and the approaches based on the pre and postconditions, such as design by contracts (DBC) and formal behavioral interface specification languages (BIS...

متن کامل

Automatic Detection to the Behavioral Conflict in AOP Application Based on Design by Contract

Behavioral conflict is one of the key issues in the practical application of AOP (Aspect-Oriented Programming) technology. Based on the ideas of design by contract and behavioral subtyping, we propose an approach that detects the behavioral conflict automatically at runtime. Use Java annotation to describe the contracts of the base program and aspect code, then extract these contracts through t...

متن کامل

Design by Contract with JML

This document gives a tutorial introduction to the Java Modeling Language (JML), and explains how JML can be used as a powerful design by contract (DBC) tool for Java. JML is a formal behavioral interface specification language for Java that contains the essential notations used in DBC as a subset. The basic concepts of DBC are explained with a particular emphasis on how to use JML notations to...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006